home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / libs / sphigs / sph_srgp.lha / srgp / doc / MAC_srgp.txt < prev    next >
Encoding:
Text File  |  1992-01-09  |  48.4 KB  |  1,118 lines

  1.                          SRGP for THINK C  ~~~  (v1.0)
  2.                              David Frederick Sklar
  3.  
  4. The Simple Raster Graphics Package is composed of a library of functions, and a
  5. header file ("srgp.h") that defines custom data types and constants, and 
  6. which prototypes all SRGP routines. This paper is a complete but extremely 
  7. terse description of the ANSI-C SRGP binding --- this is not a tutorial. If you
  8. are new to SRGP, you must read Chapter 2 of Computer Graphics --- Principles 
  9. and Practice (Foley, van Dam, Feiner, and Hughes, Addison-Wesley, 1990). 
  10.  
  11. If you wish to use the THINK Pascal version of SRGP, this document is still 
  12. your primary resource. The few important points you need to know are in the 
  13. README file distributed with the THINK Pascal version. 
  14.  
  15.  
  16.  
  17. 0)    Contrast with Textbook Specification 
  18.  
  19.  
  20.  
  21. 1)    States of the System 
  22.  
  23.  
  24.  
  25. 2)    Canvases 
  26.  
  27.  
  28.  
  29. 3)    Output 
  30.  
  31.        1)   color 
  32.  
  33.        2)   geometric data types 
  34.  
  35.        3)   control of the pattern and font tables 
  36.  
  37.        4)   control of attributes affecting output 
  38.  
  39.        5)   generation of primitives 
  40.  
  41.        6)   generation of primitives 
  42.  
  43.  
  44.  
  45. 4)    The copyPixel Procedure 
  46.  
  47.  
  48.  
  49. 5)    Input 
  50.  
  51.        1)   properties of input devices 
  52.  
  53.        2)   input modes 
  54.  
  55.        3)   input devices 
  56.  
  57.        4)   control of attributes 
  58.  
  59.        5)   control of measures 
  60.  
  61.        6)   sample procedures 
  62.  
  63.        7)   event procedures 
  64.  
  65.  
  66.  
  67. 6)    Inquiry 
  68.  
  69.  
  70.  
  71. 7)    Control of Table Sizes 
  72.  
  73.  
  74.  
  75. 8)    Diagnostics, Debugging, and Optimization 
  76.  
  77.  
  78.  
  79. 9)    Miscellaneous (Hints and Caveats and etc.)  
  80.  
  81.  
  82.  
  83. *************** SECTION 0 >>>> Contrast with Textbook Specification
  84.  
  85. Chapter 3 of the textbook is an academic study of the issues involved in 
  86. implementing any raster graphics package; it is not a description of the actual
  87. internal workings of any particular SRGP implementation. SRGP has been 
  88. implemented on several major types of hardware platforms, and in all cases, 
  89. low-level graphics utilities (QuickDraw on the Mac, X11 on workstations, and 
  90. MetaGraphics on the PC) were used. Because the authors of SRGP were not 
  91. involved in the implementation of the software actually drawing the primitives,
  92. there is no pixel-level compatibility between SRGP applications running on 
  93. different platforms. Fortunately, the inconsistency in appearance will be 
  94. typically noticeable only for extreme values for attributes (very thick 
  95. primitives, rare combinations of write mode and pen/fill style, etc.). 
  96.  
  97. The textbook spec did not discuss how SRGP would work in a windowing 
  98. environment. This document describes how the windowing environment affects 
  99. SRGP, and introduces a few new routines addressing window-specific problems. 
  100.  
  101. The textbook's description of locator echo included "no echo" as an option 
  102. available to the application. However, it was determined that an invisible 
  103. cursor is frustrating to users of a multi-window system. The "no echo" option
  104. is thus honored only by the PC version of SRGP. 
  105.  
  106. The Mac version currently does NOT support: 
  107.  
  108. **  pixmap patterns 
  109.  
  110. **  non-continuous line styles for ellipses and arcs 
  111.  
  112. **  refreshing of the screen-canvas window when it is uncovered after being 
  113.     partly or fully hidden 
  114.  
  115. Because the design of Color QuickDraw represents a sharp turn away from the 
  116. traditional "hands-on-the-hardware" approach of raster graphics, the Mac 
  117. version simply cannot support a great deal of SRGP's functionality. In 
  118. particular, the various non-trivial write modes (like XOR and OR) are supported
  119. but do not act precisely as documented. They will surprise with unpredictable 
  120. results anytime you use them when: a) you've changed entries 0 and 1 of the 
  121. color table from their default values of white and black, and/or b) your 
  122. foreground/background colors are not currently 1/0. The most popular use of 
  123. XOR'ing --- providing a reversible method of highlighting -- does work if you 
  124. follow the above two rules AND you never change the last two entries (e.g., 
  125. entries 255 and 254 on an 8-bit-deep machine) of the hardware color table. 
  126. Also, be aware that write modes other than REPLACE will not make sense when 
  127. drawing with pixmap patterns.  
  128.  
  129. The textbook did not describe methods for loading bitmap and pixmap patterns 
  130. into the respective pattern tables, for loading fonts into the font table, and 
  131. for loading entries in the color table. See sections 3.1 and 3.3 of this 
  132. document. 
  133.  
  134. There are now "deluxe" versions of the measure records for each input device.
  135. These should be used when timestamps and modifier-key chords are needed. 
  136.  
  137. The textbook specifies the size of the screen canvas cannot be changed by the 
  138. application. That is no longer the case. 
  139.  
  140.  
  141.  
  142. *************** SECTION 1 >>>> States of the System
  143.  
  144. SRGP must be enabled before use, and disabled after use. 
  145.  
  146. void SRGP_begin (char *name, int width, int height, int planes, 
  147.                  boolean enable_trace);
  148.  
  149.     The window which will represent canvas #0 (the SRGP screen-canvas) is 
  150.     created; its initial size is determined by the values of the second and 
  151.     third parameters. The first parameter specifies a name for the application.
  152.     The fifth parameter specifies the initial status of the tracing feature, 
  153.     which is described later in this section. 
  154.  
  155.     The fourth parameter is meaningful only on a display supporting color. It 
  156.     specifies how many planes of the color table should be reserved for SRGP's 
  157.     use; i.e., it places an upper bound on the number of colors that may be 
  158.     displayed simultaneously in the SRGP window. (The upper bound is 2^p 
  159.     colors, where p is the number of planes.) The fourth parameter is ignored 
  160.     when the program is run on a bilevel display. 
  161.  
  162.     If the program is being run on a color display, and you send the special 
  163.     value "0" as the fourth parameter, SRGP will take over the entire color 
  164.     table, giving your application color support as rich as the hardware can 
  165.     offer. (After initializing SRGP, you can inquire the "canvas depth" to 
  166.     determine how many planes are available.) The disadvantage: it will be 
  167.     impossible for the user to simultaneously see the SRGP window's proper 
  168.     coloring and the other clients' windows' proper coloring. Thus, you should 
  169.     request "0" planes only when your application truly needs full control of
  170.     the color table. 
  171.  
  172.     If you request more planes than available, all available planes are 
  173.     allocated, just as if you requested "0" planes. Inquiry is thus your only
  174.     way of determining exactly how many planes are available. 
  175. ------------------------------------------------------------------------------
  176. void SRGP_tracing (boolean);
  177.  
  178.     When tracing is enabled, a message is sent to a logging file (SRGPlogfile 
  179.     in the current directory) each time the application calls an SRGP function;
  180.     the message includes echoing of key parameters. IMPORTANT: Calls to some of
  181.     the input functions are NOT traced; see section 5 for details. See section 
  182.     7 for more information on execution with tracing. 
  183.  
  184.     The initial status of tracing is set when the application calls SRGP_begin,
  185.     but it may be changed at any time via a call to SRGP_tracing. 
  186. ------------------------------------------------------------------------------
  187. void SRGP_allowResize (boolean);
  188.  
  189.     By default, the screen-canvas window cannot be resized by the user. It is 
  190.     advisable that applications live with this restriction. The rare 
  191.     application that needs to allow resizing can use this routine. It is 
  192.     important to note that various artifacts occur when the user actually does 
  193.     take advantage of this freedom and perform a resize: 
  194.  
  195.    1)   The window is cleared to color 0; any information that was on the 
  196.         screen just before the resize is lost. 
  197.  
  198.    2)   The clip rectangle attribute is not changed automatically; the 
  199.         application must be responsible for changing it if necessary. 
  200.  
  201. Obviously, an application that allows resizing must be informed whenever a 
  202. resize occurs, to cope with the aforementioned problems and other 
  203. application-specific ones. SRGP provides a callback utility, which allows an 
  204. application to provide a function to be called whenever a resize has occurred: 
  205. ------------------------------------------------------------------------------
  206. typedef int (*funcptr)();
  207. void SRGP_registerResizeCallback (funcptr);
  208.  
  209.     The application-provided callback function referred to by the 
  210.     function-pointer parameter will be called whenever a resize has occurred. 
  211.     The callback function will receive two integers: the new width and the new 
  212.     height. 
  213. ------------------------------------------------------------------------------
  214. void SRGP_changeScreenCanvasSize (int newwidth, int newheight);
  215.  
  216.     This routine allows the application to modify the size of the screen 
  217.     canvas. As a side-effect, the resize-callback function (if any) is called, 
  218.     just as if the user had requested the resize.     
  219. ------------------------------------------------------------------------------
  220. void SRGP_end (void);
  221.  
  222.     The screen-canvas window is deleted, the Mac's color table is restored to 
  223.     normal, and the logging file is closed. Warning: ensure that your 
  224.     application calls this in all of its exit paths! See section 9 for related 
  225.     information on the adverse effects of failing to call this.  
  226.  
  227.  
  228.  
  229. *************** SECTION 2 >>>> Canvases
  230.  
  231. SRGP procedures operate on canvases, a canvas being a 2D array of pixels (a 
  232. virtual frame-buffer), whose depth is the number of planes requested by the 
  233. application (via the fourth parameter to SRGP_begin). 
  234.  
  235. Each canvas has its own local coordinate system. The origin (0,0) for the local
  236. coordinate system is the lower-left corner of the canvas, with the X-coordinate
  237. increasing to the right, and the Y-coordinate increasing towards the top. The 
  238. coordinates passed to all primitive-generation procedures are in terms of the 
  239. local coordinate system of the currently-active canvas. 
  240.  
  241. At any given time, one canvas is active: it is the canvas being modified. 
  242. Associated with each canvas is a group of attributes which affect all drawing 
  243. into that canvas. Modification of these attributes is only possible when the 
  244. corresponding canvas is currently active. When a canvas is created, its 
  245. attribute group is initialized to standard default values. 
  246.  
  247. Each canvas is identified by a unique integer canvas index. When SRGP is 
  248. enabled, one canvas already exists and is active: the screen canvas, having 
  249. index 0, whose height and width are determined from the parameters to SRGP_
  250. begin. The screen canvas is the only canvas which is ever visible. No more than
  251. MAX_CANVAS_INDEX+1 canvases (including the screen) may be extant 
  252. simultaneously. 
  253.  
  254. Canvases may be manipulated by the following procedures: 
  255.  
  256. typedef int canvasID;
  257. canvasID SRGP_createCanvas (int width, int height);
  258.  
  259.     An invisible canvas of the specified dimensions is created and its unique 
  260.     index is returned. The new canvas' local-coordinate-system origin (0,0) 
  261.     forms the lower-left corner. (width-1, height-1) forms the upper-right 
  262.     corner. The pixels of a canvas initially store color index 0. Once a canvas
  263.     is created, it can not be resized. (The screen canvas is an exception, but 
  264.     it can only be resized by the user, not by the application.) Upon return, 
  265.     the new canvas (and its corresponding attribute group) are active. If a new
  266.     canvas cannot be created, 0 is returned. 
  267. ------------------------------------------------------------------------------
  268. void SRGP_deleteCanvas (canvasID);
  269.  
  270.     No canvas may be deleted while it is active. Moreover, the screen canvas 
  271.     cannot be deleted with this routine. 
  272. ------------------------------------------------------------------------------
  273. void SRGP_useCanvas (canvasID);
  274.  
  275.     The specified canvas becomes active. Primitives created subsequently are 
  276.     drawn in this canvas, and attributes set subsequently modify this canvas' 
  277.     attribute group.  
  278.  
  279.  
  280.  
  281. *************** SECTION 3 >>>> Output
  282.  
  283.  
  284.  
  285.  
  286. *************** SECTION 3.1 >>>> color
  287.  
  288. SRGP maintains a lookup table (LUT) that maps color indices (which are 
  289. integers, used to index into the LUT) to actual colors. The number of entries 
  290. available in the lookup table is based on the number of planes allocated for 
  291. the application's use (via the fourth parameter to SRGP_begin). The number of 
  292. planes available can be inquired via: 
  293.  
  294. int SRGP_inquireCanvasDepth (void);
  295.  
  296. The legal color indices are numbers between (inclusive) 0 and 2^canvasdepth-1. 
  297. The use of color indices outside that range are clamped to 2^canvasdepth-1. All
  298. implementations support two colors that may be referenced using names instead 
  299. of numbers: SRGP_WHITE and SRGP_BLACK. 
  300.  
  301. Macintosh users: See section 0 for a very important note on restrictions 
  302. inherent in the Color Quickdraw version of SRGP! 
  303.  
  304. On color nodes, SRGP_WHITE is 0 and SRGP_BLACK is 1, and they are the only 
  305. initialized entries in the LUT. One should note, however, that if the first two
  306. entries of the LUT are changed by the application, the names (SRGP_BLACK and 
  307. SRGP_WHITE) are no longer meaningful. 
  308.  
  309. On monochrome displays, the two symbols SRGP_BLACK and SRGP_WHITE are 
  310. implementation-dependent constants. Moreover, the use of a color index greater 
  311. than 1 is clamped to 1 on a monochrome display. 
  312.  
  313. An application may load a contiguous portion of the LUT by creating three 
  314. arrays (one for red, one for blue, one for green) of intensity values, each 
  315. value being an unsigned 16-bit integer. Intensity value 0 represents that 
  316. primary's not contributing at all to the actual color, and 2^16-1 (65,535) 
  317. represents that primary contributing its full glory to the actual color. Note 
  318. that this method for specifying colors is machine-independent; workstations 
  319. supporting only C bits per intensity value will ignore all but the C most 
  320. significant bits of each intensity value. 
  321.  
  322. To load count entries of the LUT, starting with entry start, create the three 
  323. intensity value arrays and then call: 
  324.  
  325. typedef unsigned short ush;
  326. void SRGP_loadColorTable (int start, int count, ush *r, ush *g, ush *b);
  327.  
  328. An easy way to store "common" colors is provided by SRGP. Common colors are 
  329. those colors which have been given names (like "Purple", 
  330. "MediumForestGreen", and "Orange")  in the SRGP resource file. A complete 
  331. list of the supported colors is provided below. SRGP supports only the setting 
  332. of one LUT entry at a time when using common colors: 
  333.  
  334. void SRGP_loadCommonColor (int entry, char *colorname)
  335.  
  336. The supported colors are shown in their lower-case compressed forms below. Be 
  337. aware that you can insert spaces, and use upper-case arbitrarily, in the string
  338. you hand to SRGP_loadCommonColor. 
  339.  
  340. aliceblue         greenyellow             navyblue
  341. antiquewhite      grey                    oldlace
  342. aquamarine        honeydew                olivedrab
  343. azure             hotpink                 orange
  344. beige             indianred               orangered
  345. bisque            ivory                   orchid
  346. black             khaki                   palegoldenrod
  347. blanchedalmond    lavender                palegreen
  348. blue              lavenderblush           paleturquoise
  349. blueviolet        lawngreen               palevioletred
  350. brown             lemonchiffon            papayawhip
  351. burlywood         lightblue               peachpuff
  352. cadetblue         lightcoral              peru
  353. chartreuse        lightcyan               pink
  354. chocolate         lightgoldenrod          plum
  355. coral             lightgoldenrodyellow    powderblue
  356. cornflowerblue    lightgray               purple
  357. cornsilk          lightgrey               red
  358. cyan              lightpink               rosybrown
  359. darkgoldenrod     lightsalmon             royalblue
  360. darkgreen         lightseagreen           saddlebrown
  361. darkkhaki         lightskyblue            salmon
  362. darkolivegreen    lightslateblue          sandybrown
  363. darkorange        lightslategray          seagreen
  364. darkorchid        lightslategrey          seashell
  365. darksalmon        lightsteelblue          sienna
  366. darkseagreen      lightyellow             skyblue
  367. darkslateblue     limegreen               slateblue
  368. darkslategray     linen                   slategray
  369. darkslategrey     magenta                 slategrey
  370. darkturquoise     maroon                  snow
  371. darkviolet        mediumaquamarine        springgreen
  372. deeppink          mediumblue              steelblue
  373. deepskyblue       mediumorchid            tan
  374. dimgray           mediumpurple            thistle
  375. dimgrey           mediumseagreen          tomato
  376. dodgerblue        mediumslateblue         turquoise
  377. firebrick         mediumspringgreen       violet
  378. floralwhite       mediumturquoise         violetred
  379. forestgreen       mediumvioletred         wheat
  380. gainsboro         midnightblue            white
  381. ghostwhite        mintcream               whitesmoke
  382. gold              mistyrose               yellow
  383. goldenrod         moccasin                yellowgreen
  384. gray              navajowhite   
  385. green             navy
  386.  
  387. Warning: The Mac's color table can sometimes be left in a disturbed state when 
  388. an SRGP application exits prematurely. See section 9 of this document for more 
  389. information. 
  390.  
  391.  
  392.  
  393. *************** SECTION 3.2 >>>> geometric data types
  394.  
  395. The following SRGP data types allow storage of geometric entities: 
  396.  
  397. typedef struct {
  398.       int x, y;
  399. } point;
  400.  
  401. typedef struct {
  402.       point bottom_left, top_right;
  403. } rectangle;
  404.  
  405. Instances of these data types may be created using these routines: 
  406.  
  407. point SRGP_defPoint (int x, int y);
  408. rectangle SRGP_defRectangle (int left_x, int bottom_y, int right_x, int top_y);
  409.  
  410.     
  411.  
  412.  
  413.  
  414. *************** SECTION 3.3 >>>> control of the pattern and font tables
  415.  
  416. Several of the SRGP attributes are patterns to be used for filling areas and 
  417. for drawing lines and frames. Two pattern tables are supported: one storing 
  418. bitmaps and one storing pixmaps. 
  419.  
  420. The bitmap pattern table is initialized in this way: Pattern 0 is all 
  421. background, and pattern 1 is all foreground. Patterns 1 through 38 are the 
  422. standard Macintosh patterns shown in Volume 1 of Chernicoff's Macintosh 
  423. Revealed, and page I-474 of Inside Macintosh. Patterns 40 through 104 are 
  424. greyscale patterns increasing gradually in intensity from all background (40) 
  425. to all foreground (104).  All other entries in the bitmap pattern table have 
  426. random patterns initially. To see an array of tiles showing the default bitmap 
  427. pattern table, run the example program show_patterns. 
  428.  
  429. Only entry 0 in the pixmap pattern table is defined, and it is simply an 
  430. all-color-0 pattern. 
  431.  
  432. SRGP provides two methods for changing entries in the pattern table: 
  433.  
  434. **  You can have SRGP load one or more patterns from a file which stores 
  435.     ASCII-text pattern specifications you can create using a text editor or 
  436.     convenient bitmap-editor programs (if available). 
  437.  
  438. **  You can give SRGP a pattern specification in the form of an array of 
  439.     numbers. 
  440.  
  441. To load a bitmap pattern from a file, open the file and pass the stream to the 
  442. function: 
  443.  
  444. int SRGP_loadBitmapPatternsFromFile (FILE *stream);
  445.  
  446. The input may be composed of one or more pattern specifications ("specs"). 
  447. Each spec must occupy exactly two lines and must match this format: 
  448.  
  449. static char bitpat_Xy[] = {
  450.    0x??, 0x??, 0x??, 0x??, 0x??, 0x??, 0x??, 0x??};
  451.  
  452. where X is a non-negative integer specifying the index of the entry to be set, 
  453. y is any arbitrary garbage between the integer and the left square-brace, and 
  454. 0x?? is any arbitrary byte value represented in hexadecimal.  
  455.  
  456. As a convenience, any lines beginning with # are ignored, but these comment 
  457. lines must not interrupt a single two-line spec sequence. Blank unused lines 
  458. are not allowed anywhere in the file. 
  459.  
  460. The closing of the input stream must be performed by the caller. This function 
  461. returns 1 if any problems at all occurred; since its parser makes no attempt at
  462. error recovery, it is wise to check the return value. 
  463.  
  464. To load a pixmap pattern from a file, use this routine whose functionality is 
  465. similar to that of the one for bitmap patterns: 
  466.  
  467. int SRGP_loadPixmapPatternsFromFile (FILE *stream);
  468.  
  469. Warning: the current Macintosh version does not support this. The input may be 
  470. composed of one or more pattern specifications, each matching this format: 
  471.  
  472. static int pixpat_Xy[] = {
  473.    ?, ?, ?, ?, ?, ?, ?, ?,
  474.    ?, ?, ?, ?, ?, ?, ?, ?,
  475.    ?, ?, ?, ?, ?, ?, ?, ?,
  476.    ?, ?, ?, ?, ?, ?, ?, ?,
  477.    ?, ?, ?, ?, ?, ?, ?, ?,
  478.    ?, ?, ?, ?, ?, ?, ?, ?,
  479.    ?, ?, ?, ?, ?, ?, ?, ?,
  480.    ?, ?, ?, ?, ?, ?, ?, ?};
  481.  
  482. In this specification, each ? represents a decimal integer color index. 
  483.  
  484. Applications generating the patterns at runtime can use these routines to set 
  485. one entry at a time: 
  486.  
  487. void SRGP_loadBitmapPattern (int pattern_id, char *data);
  488. void SRGP_loadPixmapPattern (int pattern_id, int *data);
  489.  
  490.     The former routine expects an array of 8 characters; the latter an array of
  491.     64 integers. Warning: the current Macintosh version does not support the 
  492.     loading of pixmap patterns. 
  493.  
  494. Another attribute is the font to be used for text. SRGP provides a table of 
  495. fonts that may be used and modified by the application. Each entry is 
  496. identified by a unique font index (ranging from 0 to MAX_FONT_INDEX). 
  497. Initially, only entry #0 of the font table is defined. The application can 
  498. modify the table via: 
  499.  
  500. void SRGP_loadFont (int fontindex, char *name);
  501.  
  502.     This function allows the application to load a font into a given entry of 
  503.     the table.  The name of the font must comply with the format 
  504.     font.size.style where font is the name of a Macintosh font family (e.g., 
  505.     "Chicago"), size is any positive number representing points, and style is
  506.     a collection of single-letter style codes: b for bold, i for italic, u for 
  507.     underline, o for outline, s for shadow, c for condense, or e for extend. If
  508.     plain text is desired, you may use the format font.size with or without a 
  509.     terminating period. 
  510.  
  511.  
  512.  
  513. *************** SECTION 3.4 >>>> control of attributes affecting output
  514.  
  515. These procedures allow control of the value of each attribute associated with 
  516. the currently-active canvas. 
  517.  
  518. typedef enum {WRITE_REPLACE, WRITE_XOR, WRITE_OR, WRITE_AND} writeModeType;
  519. void SRGP_setWriteMode (writeModeType);
  520.  
  521.     The write mode affects the writing of a pixel, the generation of a 
  522.     primitive, and the copying of a rectangular portion of a canvas. The 
  523.     default is WRITE_REPLACE. Please see the important note on Mac's limited 
  524.     support of write modes, in section 0 of this manual. 
  525. ------------------------------------------------------------------------------
  526. void SRGP_setClipRectangle (rectangle);
  527.  
  528.     All subsequently-created primitives and subsequent pixel-copyings are 
  529.     clipped to the specified rectangle. The default clipping rectangle is 
  530.     exactly the size of the associated canvas. It is illegal to set the 
  531.     clipping rectangle to a rectangle which does not lie completely within the 
  532.     boundaries of its associated canvas. 
  533. ------------------------------------------------------------------------------
  534. void SRGP_setFont (int font_index);
  535.  
  536.     The application chooses from a font by giving the index (ranging from 0 to 
  537.     MAX_FONT_INDEX) into the font table. The default is 0, the only entry in 
  538.     the font table which is initialized when SRGP is launched. 
  539. ------------------------------------------------------------------------------
  540. void SRGP_setMarkerSize (int width_in_pixels);
  541.  
  542.     This describes the dimensions of the imaginary square that circumscribes a 
  543.     marker's image. 
  544. ------------------------------------------------------------------------------
  545. typedef enum {MARKER_CIRCLE, MARKER_SQUARE, MARKER_X} markerStyleType;
  546. void SRGP_setMarkerStyle (markerStyleType);
  547.  
  548.     SRGP supports three different marker shapes, circle being the default. 
  549. ------------------------------------------------------------------------------
  550. typedef enum {CONTINUOUS, DASHED, DOTTED, DOT_DASHED} lineStyleType;
  551. void SRGP_setLineStyle (lineStyleType);
  552. void SRGP_setLineWidth (int width_in_pixels);
  553.  
  554.     The default line style is continuous, default line width is 1. On the 
  555.     Macintosh, the true width of a line may be greater than the width you 
  556.     specify, depending upon the line's slope. The true width will match the 
  557.     specified width only for horizontal and vertical lines. Warning: in the 
  558.     Macintosh version, ellipses and arcs are always drawn using the 
  559.     "continuous" line style. 
  560. ------------------------------------------------------------------------------
  561. void SRGP_setColor (int color_index);
  562.  
  563.     This sets the foreground (drawing) color to the color that is stored at the
  564.     given entry in the LUT; the default is 1. 
  565. ------------------------------------------------------------------------------
  566. void SRGP_setBackgroundColor (int color_index);
  567.  
  568.     Default is 0. The background color is used to color the pixels denoted by 0
  569.     values in opaque bitmap pattern fills. 
  570. ------------------------------------------------------------------------------
  571. void SRGP_setPlaneMask (int bitmask);
  572.  
  573.     (Warning: Currently the Macintosh version does not support this!)  
  574. ------------------------------------------------------------------------------
  575. typedef enum {
  576.   SOLID, BITMAP_PATTERN_OPAQUE, BITMAP_PATTERN_TRANSPARENT, PIXMAP_PATTERN}
  577.     drawStyle;
  578. void SRGP_setFillStyle (drawStyle);
  579. void SRGP_setPenStyle (drawStyle);
  580.  
  581.     Fill style affects filled primitives; pen style affects outlined (framed) 
  582.     primitives or lines. Text is not affected by either of these attributes. 
  583.     Default is SOLID. Pixmap patterns are currently not implemented in Mac 
  584.     version. 
  585. ------------------------------------------------------------------------------
  586. void SRGP_setFillBitmapPattern (int pattern_index);
  587. void SRGP_setFillPixmapPattern (int pattern_index);
  588. void SRGP_setPenBitmapPattern (int pattern_index);
  589. void SRGP_setPenPixmapPattern (int pattern_index);
  590.  
  591.     Denotes the entry in the appropriate pattern table which is to be used when
  592.     the fill or pen style is not SOLID. Pixmap patterns are currently not 
  593.     implemented on the Mac. 
  594.  
  595. The entire set of attributes may be set to a previously-stored group of values 
  596. using the function described next. Later in this reference is described the 
  597. function (SRGP_inquireAttributes) that allows inquiry of the current attribute 
  598. group. 
  599.  
  600. typedef struct ... attribute_group;   /* see srgppublic.h for details */
  601. void SRGP_setAttributes (attribute_group*);
  602.  
  603.     The parameter's value should have been obtained from a previous call to 
  604.     SRGP_inquireAttributes. 
  605.  
  606.  
  607.  
  608. *************** SECTION 3.5 >>>> generation of primitives
  609.  
  610. The functions described in this section perform drawing in the currently active
  611. canvas. For each primitive generator described, the list of attributes 
  612. affecting its operation is presented. 
  613.  
  614. An ellipse is specified in terms of the rectangle within which it is inscribed.
  615. Polygons, rectangles, and ellipses may be generated as framed or filled. A 
  616. filled primitive is all-interior --- the frame is not displayed.      
  617.  
  618. void SRGP_point (point);
  619. void SRGP_pointCoord (int x, int y);
  620.  
  621.     Current write mode, foreground color, and plane mask apply. 
  622. ------------------------------------------------------------------------------
  623. void SRGP_marker (point)
  624. void SRGP_markerCoord (int x, int y)
  625.  
  626.     Current marker style, marker size, write mode, foreground color, and plane 
  627.     mask apply. 
  628. ------------------------------------------------------------------------------
  629. void SRGP_line (point pt1, point pt2);
  630. void SRGP_lineCoord (int x1, int y1,  int x2, int y2);
  631.  
  632. void SRGP_rectangle (rectangle);
  633. void SRGP_rectanglePt (point lower_left, point upper_right);
  634. void SRGP_rectangleCoord (int left_x, int lower_y,  int right_x, int upper_y);
  635.  
  636.     Current write mode, plane mask, colors, line width, line style, and pen 
  637.     style apply. 
  638. ------------------------------------------------------------------------------
  639. void SRGP_polyPoint (int vert_count, point *vertices);
  640. void SRGP_polyMarker (int vert_count, point *vertices);
  641. void SRGP_polyLine (int vert_count, point *vertices);
  642. void SRGP_polygon (int vert_count, point *vertices);
  643.  
  644. void SRGP_polyPointCoord (int vert_count, int *x_coords, int *y_coords);
  645. void SRGP_polyMarkerCoord (int vert_count, int *x_coords, int *y_coords);
  646. void SRGP_polyLineCoord (int vert_count, int *x_coords, int *y_coords);
  647. void SRGP_polygonCoord (int vert_count, int *x_coords, int *y_coords);
  648.  
  649.     Current write mode, plane mask, colors, line width, line style, and pen 
  650.     style apply. SRGP_polygon(Coord) automatically connects the first and last 
  651.     vertices to form a closed polygon. Lists of vertices and coordinates are 
  652.     limited in size to MAX_POINTLIST_SIZE. 
  653. ------------------------------------------------------------------------------
  654. void SRGP_ellipse (rectangle bounds);
  655. void SRGP_ellipseArc (rectangle bounds, double startangle, double endangle);
  656.  
  657.     Current write mode, plane mask, colors, line width, line style, and pen 
  658.     style apply. An arc extends counterclockwise from the start angle to the 
  659.     end angle. Angles are in rectangular degrees and must lie between 0 and 
  660.     360, with 0 degrees being a horizontal ray extending towards positive 
  661.     infinity. 
  662. ------------------------------------------------------------------------------
  663. void SRGP_fillPolygon (int vert_count, point *vertices);
  664. void SRGP_fillPolygonCoord (int vert_count, int *x_coords, int *y_coords);
  665. void SRGP_fillEllipse (rectangle);
  666. void SRGP_fillEllipseArc (rectangle bounds, double startangle, double endangle);
  667. void SRGP_fillRectangle (rectangle);
  668. void SRGP_fillRectanglePt (point lower_left, point upper_right);
  669. void SRGP_fillRectangleCoord (int left_x, int lower_y, int right_x, int upper_y);
  670.  
  671.     Current write mode, plane mask, colors, and fill style apply. 
  672. ------------------------------------------------------------------------------
  673. void SRGP_text (point origin, char *str);
  674.  
  675.     Current write mode, plane mask, foreground color, and font apply. The 
  676.     origin marks the leftmost point to be affected by the text, and marks the 
  677.     horizontal baseline for the text, under which only the text's characters' 
  678.     descenders will appear. 
  679.  
  680.  
  681.  
  682. *************** SECTION 3.6 >>>> audio output
  683.  
  684.  
  685. void SRGP_beep (void);
  686.  
  687.     
  688.  
  689.  
  690.  
  691. *************** SECTION 4 >>>> The copyPixel Procedure
  692.  
  693. This procedure allows a portion of a canvas to be copied into another part of 
  694. itself or into another canvas. See the textbook for more information on this 
  695. powerful feature. 
  696.  
  697. void SRGP_copyPixel (canvasID source_canvas, rectangle source_rect, 
  698.                      point dest_corner);
  699.  
  700.     The copying operation is composed of two parts. First, a copy of a 
  701.     rectangular portion of a canvas is created. Then, the copy is placed 
  702.     somewhere within the currently-active canvas. (The currently-active canvas 
  703.     may or may not also be the canvas providing the source of the copy.) 
  704.  
  705.     dest_corner describes the lower-left corner of the destination rectangle 
  706.     (lying inside the currently-active canvas) having the same size as source_
  707.     rect. 
  708.  
  709.     Only the rectangular portion of source_rect which lies within the 
  710.     boundaries of the source canvas is copied. The placement operation is 
  711.     affected by the current clipping-rectangle and write-mode.  
  712.  
  713.  
  714.  
  715. *************** SECTION 5 >>>> Input
  716.  
  717. An application program obtains input from an operator by controlling a set of 
  718. logical input devices, each representing a unique input technique. Each device 
  719. may be placed in a number of different input modes, each representing a unique 
  720. type of interaction with the input device. 
  721.  
  722.  
  723.  
  724. *************** SECTION 5.1 >>>> properties of input devices
  725.  
  726. Each input device is described in terms of these information: a measure, a 
  727. trigger set, and a set of attributes. 
  728.  
  729. The measure of an input device is the value currently associated with the 
  730. device. 
  731.  
  732. The trigger of an an input device is the action which indicates a significant 
  733. moment associated with the device. 
  734.  
  735. The attributes of an input device are the parameters of the device which are 
  736. under application-control, primarily the echo characteristics. 
  737.  
  738. At any given time, each device is either active or inactive. The process of 
  739. activation places a device into an active state; the process of deactivation 
  740. places it into an inactive state. Zero or more devices may be simultaneously 
  741. active. 
  742.  
  743.  
  744.  
  745. *************** SECTION 5.2 >>>> input modes
  746.  
  747. There are three modes in which input devices operate. (Initially, each device 
  748. is inactive.) The modes' names are listed below, accompanied by a description: 
  749.  
  750.          INACTIVE   When device X is inactive, no events are posted concerning 
  751.                     it, and its measure is not available to the application. 
  752.  
  753.            SAMPLE   When device X is in Sample mode, it is active. The 
  754.                     application may call SRGP_sampleX to immediately obtain the
  755.                     measure of input device X. The firings of X-triggers do not
  756.                     have any effects. 
  757.  
  758.             EVENT   When device X is in Event mode, it is active. The firing of
  759.                     an X-trigger causes an input report (containing the measure
  760.                     of the device at the time of the firing) to be appended to 
  761.                     the input queue. 
  762.  
  763. The following function allows control of the input modes and echoing for all 
  764. input devices: 
  765.  
  766. typedef enum {NO_DEVICE, LOCATOR, KEYBOARD} inputDevice;
  767. typedef enum {INACTIVE, SAMPLE, EVENT} inputMode;
  768. void SRGP_setInputMode (inputDevice, inputMode);
  769.  
  770.     The specified input device is placed in the specified mode. Whenever device
  771.     X's mode is changed from Inactive to either Sample or Event, the device is 
  772.     activated: its measure is initialized (to a static default initial value, 
  773.     or to a value specified by the application while the device was inactive) 
  774.     and echoing begins. When X's mode is set to Event, queueing of the device's
  775.     event reports is enabled as well. When X's mode is changed from Event, all 
  776.     queued events for that device are discarded. 
  777.  
  778.     When X's mode is set to Inactive, the device is deactivated: trigger 
  779.     firings from the device are ignored and echoing is disabled. 
  780.  
  781.  
  782.  
  783. *************** SECTION 5.3 >>>> input devices
  784.  
  785. The SRGP input devices are described in this section. 
  786.  
  787.  
  788.  
  789.   LOCATOR   The measure of the Locator device incorporates a position expressed
  790.             in the coordinate system of the screen canvas, a chord giving the 
  791.             status of the mouse buttons, and the number of the button which 
  792.             most recently experienced a transition. The button-chord array is 
  793.             indexed using three constants: LEFT_BUTTON, MIDDLE_BUTTON, and 
  794.             RIGHT_BUTTON. The Macintosh version treats the sole mouse button as
  795.             the left button, and pretends the middle and right are always 
  796.             "up". 
  797.  
  798.             The button-mask attribute of this device determines which of the 
  799.             buttons are of interest when the device is active in Event mode: 
  800.             only buttons specified in this mask can trigger an event. 
  801.  
  802.                typedef enum {UP, DOWN} buttonStatus;
  803.                typedef struct {
  804.                   point position;
  805.                   buttonStatus button_chord[3];
  806.                   int button_of_last_transition;
  807.                } locator_measure;
  808.  
  809.             The "deluxe" version of the locator measure includes a chord 
  810.             giving the status of three primary modifier keys at the time of the
  811.             last button transition, and a timestamp structure. The modifier 
  812.             chord array is indexed via SHIFT, CONTROL, and META.  (The META key
  813.             is labelled "option" on the Macintosh keyboards.) The timestamp 
  814.             specifies the time at which the most recent change to the measure 
  815.             occurred --- i.e., successive sampling of a non-moving locator 
  816.             produces a "constant" timestamp. 
  817.  
  818.               typedef struct {
  819.                  int seconds;  /* duration since application launch */
  820.                  int ticks;    /* a tick is 1/60th second */
  821.               } srgp_timestamp;
  822.  
  823.               typedef struct {
  824.                  point position;
  825.                  buttonStatus button_chord[3];
  826.                  int button_of_last_transition;
  827.                  buttonStatus modifier_chord[3]; /* status at last transition */
  828.                  srgp_timestamp timestamp;
  829.               } deluxe_locator_measure;
  830.  
  831.  
  832.  
  833.  KEYBOARD   The measure of this device is a character string, storing either a 
  834.             single ASCII character code or a sequence of printable characters. 
  835.  
  836.             The "deluxe" version of the measure includes the modifier chord, 
  837.             a timestamp, and a locator position: 
  838.  
  839.                typedef struct {
  840.                   char *buffer;   /* ptr to space allocated by application */
  841.                   int buffer_length;   /* set by application */
  842.                   buttonStatus modifier_chord[3];
  843.                   point position;
  844.                   srgp_timestamp timestamp;
  845.                } deluxe_keyboard_measure;
  846.  
  847.             The processing-mode attribute of this device determines which of 
  848.             the two meanings is given to the measure of the device: 
  849.  
  850.              RAW:   When a key is hit, the measure stores a string of length 1 
  851.                     whose single element is the ASCII character code of the key
  852.                     hit (taking into account the status of the shift and 
  853.                     control modifier keys) and a trigger-firing occurs. The 
  854.                     modifier chord shows the status of the modifiers when the 
  855.                     key was hit. No echo occurs in RAW mode. 
  856.  
  857.             EDIT:   (the default) When a key representing a printable character
  858.                     is hit and the string is not yet full, the character is 
  859.                     appended to the string. When the backspace key is hit, the 
  860.                     last character of the string is deleted. When return is 
  861.                     hit, an event is sent (representing the full value of the 
  862.                     string) and the measure is set to the null string. In EDIT 
  863.                     mode, the modifier chord is not maintained and should be 
  864.                     ignored. 
  865.  
  866. C programmers should take care to allocate a buffer large enough to include the
  867. null character that terminates the string measure. For example, two bytes are 
  868. needed to store a RAW-mode measure. 
  869.  
  870.  
  871.  
  872. *************** SECTION 5.4 >>>> control of attributes
  873.  
  874. The following procedures set the attributes for input devices. Attributes may 
  875. be set at any time, regardless of whether the device is active or inactive. 
  876.  
  877. void SRGP_setLocatorButtonMask (int value);
  878.  
  879.     The value should be 0 or an OR combination of one or more of the following 
  880.     defined constants: LEFT_BUTTON_MASK, MIDDLE_BUTTON_MASK, and RIGHT_BUTTON_
  881.     MASK. Initially the value is LEFT_BUTTON_MASK: meaning only the left button
  882.     (which is the only button on a 1-button mouse) generates events. 
  883. ------------------------------------------------------------------------------
  884. SRGP_setLocatorEchoType (int value);  /* CURSOR, RUBBER_LINE, or RUBBER_RECT */
  885.  
  886.     An application can choose to have just the cursor, or to also have a 
  887.     rubber-primitive (anchored at a fixed point with the other end of the 
  888.     primitive following the cursor's movement). Note: the value NO_ECHO is also
  889.     accepted, but it is ignored on all platforms except the IBM PC. 
  890.  
  891. SRGP provides a cursor table whose 0th entry is initialized to an arrow; all 
  892. other entries are unusable until loaded. 
  893.  
  894. void SRGP_loadCursorTable (int cursor_index, int shape);
  895.  
  896.  
  897.     Legal cursor indices are numbers between 0 and MAX_CURSOR_INDEX, inclusive.
  898.     The shape may be one of the following: 1 for the standard Mac "I-beam" 
  899.     text cursor, 2 for a cross, 3 for a "plus" cursor, and 4 for a watch 
  900.     icon. The shape may also be the resource ID of a customized cursor placed 
  901.     as a "CURS" resource in the application's resource file. 
  902.  
  903. The attributes for the locator's echo are set via: 
  904.  
  905. void SRGP_setLocatorEchoCursorShape (int cursor_index);
  906. void SRGP_setLocatorEchoRubberAnchor (point position);
  907.  
  908.     
  909.  
  910. The keyboard's attributes are set via: 
  911.  
  912. typedef enum {EDIT, RAW} keyboardMode;
  913. void SRGP_setKeyboardProcessingMode (keyboardMode);
  914. void SRGP_setKeyboardEchoColor (int color_index);
  915. void SRGP_setKeyboardEchoFont (int font_index);
  916. void SRGP_setKeyboardEchoOrigin (point position);
  917.  
  918.     Keyboard echo attributes are only meaningful when the keyboard is active in
  919.     EDIT processing mode. Setting the keyboard's processing mode (default EDIT)
  920.     clears the keyboard's measure as a side-effect. 
  921.  
  922.  
  923.  
  924. *************** SECTION 5.5 >>>> control of measures
  925.  
  926. The measure of a device may be changed by the application at any time. If the 
  927. change is performed while the device is active, the measure immediately 
  928. changes, as does as echoing concerning the device. If it is done while the 
  929. device is inactive, the specified measure is used to initialize the device's 
  930. measure the next time it is activated. NOTE: the button-related fields of the 
  931. locator measure may not be changed by the application. 
  932.  
  933. void SRGP_setLocatorMeasure (point value);
  934. void SRGP_setKeyboardMeasure (char *value);
  935.  
  936.     
  937.  
  938.  
  939.  
  940. *************** SECTION 5.6 >>>> sample procedures
  941.  
  942. The involved input device must be in SAMPLE mode. Each function places in the 
  943. provided place the current measure of the corresponding device. Calls to these 
  944. routines are NOT traced. 
  945.  
  946. The SRGP_sampleKeyboard function copies the keyboard measure into the given 
  947. character-array buffer of size buffer_length. If the current keyboard measure 
  948. is longer than (bufferlength-1) bytes, it is truncated. Similarly, the 
  949. keyboard-measure structure sent to SRGP_sampleDeluxeKeyboard must have pre-set 
  950. values for its buffer and buffer_length fields. 
  951.  
  952. void SRGP_sampleLocator (locator_measure *measure);
  953. void SRGP_sampleKeyboard (char *buffer, int buffer_length);
  954. void SRGP_sampleDeluxeLocator (deluxe_locator_measure *measure);
  955. void SRGP_sampleDeluxeKeyboard (deluxe_keyboard_measure *measure);
  956.  
  957.     
  958.  
  959.  
  960.  
  961. *************** SECTION 5.7 >>>> event procedures
  962.  
  963. Calls to these functions are NOT traced. 
  964.  
  965. inputDevice SRGP_waitEvent (int maximum_wait_time);
  966.  
  967.     If, upon entry, the event queue is not empty, the procedure exits 
  968.     immediately, identifying the event report at the head of the queue and 
  969.     removing the report from the queue. Otherwise, the application enters a 
  970.     wait state, which is exited upon the first occurrence of a trigger-firing 
  971.     from any device which is currently in EVENT mode. The wait state never 
  972.     lasts for more than the number of ticks (1/60 seconds) given in the maximum
  973.     _wait_time parameter (which, when negative, represents infinity). An 
  974.     application can "poll" the queue (avoiding a wait state) by specifying 
  975.     "0" as the maximum wait time. 
  976.  
  977.     The return value identifies the device causing the event. The special value
  978.     NO_DEVICE is returned when the procedure exits due to timeout. 
  979.  
  980. When an application discovers that an input event (not a timeout) caused the 
  981. return of SRGP_waitEvent, it may obtain the data associated with the involved 
  982. event by using the appropriate "get" function, whose parameters and return 
  983. values mimic those of the sample functions: 
  984.  
  985. void SRGP_getLocator (locator_measure *measure);
  986. void SRGP_getKeyboard (char *measure, int buffer_length);
  987. void SRGP_getDeluxeLocator (deluxe_locator_measure *measure);
  988. void SRGP_getDeluxeKeyboard (deluxe_keyboard_measure *measure);
  989.  
  990.     
  991.  
  992.  
  993.  
  994. *************** SECTION 6 >>>> Inquiry
  995.  
  996. NOTE: Calls to these routines are NOT traced. 
  997.  
  998. void SRGP_inquireAttributes (attribute_group *group);
  999.  
  1000.     The current states of all attributes are copied into the provided group 
  1001.     structure. For information on the names of the fields in the structure, see
  1002.     srgppublic.h. 
  1003. ------------------------------------------------------------------------------
  1004. canvasID SRGP_inquireActiveCanvas (void);
  1005.  
  1006.     This function allows inquiry of the ID of the currently-active canvas. 
  1007. ------------------------------------------------------------------------------
  1008. rectangle SRGP_inquireCanvasExtent (canvasID);
  1009. void SRGP_inquireCanvasSize (canvasID, int *width, int *height);
  1010.  
  1011.     Two functions allowing inquiry of the size of a canvas. 
  1012. ------------------------------------------------------------------------------
  1013. int SRGP_inquireCanvasDepth (void);
  1014.  
  1015.     Returns the number of planes available in all canvases. 
  1016. ------------------------------------------------------------------------------
  1017. void SRGP_inquireTextExtent (char *str, int *width, int *ascent, int *descent);
  1018.  
  1019.     This procedure allows inquiry of the rectangular extent which would be 
  1020.     covered by the output of the given character string with the current font 
  1021.     attribute.  
  1022.  
  1023.  
  1024.  
  1025. *************** SECTION 7 >>>> Control of Table Sizes
  1026.  
  1027. The tables that store patterns, fonts, etc. have default sizes that in many 
  1028. cases are acceptable. You may, however, choose to reduce the size of a table to
  1029. save memory (if you're working on a Mac Plus, for instance) or increase the 
  1030. size of a table if you need more entries. You may change the size of a table 
  1031. only before SRGP is initialized! 
  1032.  
  1033. void SRGP_setMaxCanvasIndex (int i);
  1034. void SRGP_setMaxPatternIndex (int i);
  1035. void SRGP_setMaxCursorIndex (int i);
  1036. void SRGP_setMaxFontIndex (int i);
  1037. void SRGP_setMaxPointlistSize (int i);
  1038.  
  1039.     See srgp_sphigs.h for the defaults for these sizes. NOTE: Do not reduce the
  1040.     size of the pattern table!  
  1041.  
  1042.  
  1043.  
  1044. *************** SECTION 8 >>>> Diagnostics, Debugging, and Optimization
  1045.  
  1046. SRGP offers two features that aid the developer in debugging an application. 
  1047. Both of these features may be disabled or enabled by the programmer and even by
  1048. the user at run-time, in order to optimize the execution. 
  1049.  
  1050. The first feature is tracing. When enabled, each call to an SRGP routine 
  1051. (except a few input-related routines) produces a detailed message in a log 
  1052. file. A parameter to SRGP_begin() controls the initial state of tracing; calls 
  1053. to SRGP_tracing can be used to control the state during runtime. Early test 
  1054. runs of an application should always be performed with tracing enabled. For 
  1055. more details on tracing, see Section 1. 
  1056.  
  1057. The second feature is parameter verification. All SRGP routines perform 
  1058. verification of all parameters (except those that are pointers to an array or 
  1059. structure) before they commence operation. All errors are fatal and produce a 
  1060. crash with a detailed error message. Only when a program is fully debugged 
  1061. should optimization efforts include disabling parameter verfication! You may 
  1062. permanently disable verification and tracing via: 
  1063.  
  1064. void SRGP_disableDebugAids (void);
  1065.  
  1066. About SRGP's diagnostics: There are two types of run-time errors. The first 
  1067. type is parameter-verification errors; the verification can be turned off as 
  1068. mentioned earlier. The second type occurs when a problem unrelated to bad input
  1069. occurs, like running out of memory when attempting to allocate a canvas. All 
  1070. errors -- of both types -- are considered fatal by default, and cause a crash 
  1071. after displaying an informative message to the user. Some programmers might 
  1072. wish to make all errors be non-fatal, so program execution can continue (with 
  1073. suitable recovery algorithms, of course). The following routine can be used to 
  1074. choose between fatal and non-fatal error handling: 
  1075.  
  1076. typedef enum {FATAL_ERRORS, NON_FATAL_ERRORS} errorHandlingMode;
  1077. void SRGP_setErrorHandlingMode (errorHandlingMode);
  1078.  
  1079. When an error is detected by SRGP while the mode is NON_FATAL_ERRORS, no 
  1080. message is issued to the user; rather, a global variable is set to a positive 
  1081. integer that represents the error: 
  1082.  
  1083. #include "srgp_errtypes.h"
  1084. extern int SRGP_errorOccurred;
  1085.  
  1086. The header file contains symbolic constants mapping the integers to error 
  1087. types. The global variable is never reset to 0 by SRGP; the application is 
  1088. responsible for examining and resetting it. Obviously, non-fatal mode should be
  1089. used with great care, and only late in an application's development.  
  1090.  
  1091.  
  1092.  
  1093. *************** SECTION 9 >>>> Miscellaneous (Hints, Caveats, etc.)
  1094.  
  1095. An SRGP application cannot control multiple windows: only canvas #0 is 
  1096. represented by a visible window. 
  1097.  
  1098. When using this Macintosh version, you should keep the screen-canvas window 
  1099. uncovered and fully within the screen bounds at all times, because SRGP cannot 
  1100. perform "damage repair" in its Macintosh incarnation. 
  1101.  
  1102. A great amount of memory is needed to support off-screen canvases when using 
  1103. Color QuickDraw. Even if the application requests the use of only a few of the 
  1104. available planes, the depth of the allocated canvas will match the depth of the
  1105. display hardware. If you run out of memory when you know your machine is 
  1106. capable of a lot more, you may need to use the "Set Project Type..." dialog 
  1107. (under the "Project" menu in THINK C) to increase the partition size for your
  1108. project.    
  1109.  
  1110. If an application is terminated before it calls SRGP_end, you are returned to 
  1111. the Finder or to THINK C with a damaged color table. You can easily fix the 
  1112. color table by using the "Control Panel" "Monitors" desk accessory. Simply 
  1113. select a different item (e.g., 16) in the "characteristics" list, and then 
  1114. re-select the original item (e.g., 256).  
  1115.  
  1116.  
  1117.                                   --- FIN ---
  1118.